#ifndef __MY_SHARED_MEMORY__
#define __MY_SHARED_MEMORY__

#ifndef TRUE
#define TRUE  1
#endif

#ifndef FALSE
#define FALSE 0
#endif

#define SHARED_MEM_START 0x400000
#define SHARED_MEM_END 0x500000

#define BUFFER_LEN 1024
#define CMDS 100

#define WAIT_UNTIL_UNLOCK while(smem->locked == 1){}
#define LOCK smem->locked = 1
#define UNLOCK smem->locked = 0

struct sharedMem{
    char locked;
    int posX;
    int posY;
    unsigned int sek;
    unsigned int fileAdress;
    unsigned char stdIn[BUFFER_LEN];
    unsigned char stdOut[BUFFER_LEN];
    int stdInPos;
    int stdOutPos;
    char clearScreen;
    int cmdList[CMDS];
    int cmdMax;
};


void getPositionsFromSharedMem(int *posX, int *posY);
int getPosX();
int getPosY();
int getPosXLOCK();
int getPosYLOCK();
void unlockSharedMem();
void updatePosXY(int posX, int posY);
void initSharedMemory();
void setPosX(int posX);
void setPosY(int posY);
void addKeyToStdIn(char c);
void addCharToStdOut(char c);
int getStdOutPosition();
char getCharInStdOutAtPosition(int pos);
char isLocked();
char getClearScreen();
void setClearScreen(char s);
char *getStdIn();
void flushStdIn();
int getStdInPosition();

#endif

